package com.ase.单例模式.advanced;

/**
 * 双重锁 DCL懒汉式
 * @author gyhstart
 * @create 2021/2/15 - 14:49
 **/
public class Singleton {
    private static Singleton singleton;

    private Singleton() {
    }

    private static Singleton getInstance() {
        if (singleton == null) {
            synchronized (Singleton.class) {
                if (singleton == null) {
                    singleton = new Singleton();
                }
            }
        }
        return singleton;
    }
}
